package com.sghd.fight.module.game.event;

import com.sghd.common.event.Event;
import com.sghd.common.socket.session.Session;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;

/**
 * 登出事件体
 */
public class DisconnectEvent {

    public static final String NAME = "SESSION:DISCONNECT";
    private long player;
    /** 触发原因 */
    private int cause;
    /** 会话 */
    private Session session;

    // Getter and Setter ...

    public long getPlayer() {
        return player;
    }

    public int getCause() {
        return cause;
    }

    public String getName() {
        return NAME;
    }

    public Session getSession() {
        return session;
    }

    @Override
    public String toString() {
        return ReflectionToStringBuilder.toString(this);
    }

    // Static Method's ...

    /** 构造方法 */
    public static Event<DisconnectEvent> valueOf(long player, int cause, Session session) {
        DisconnectEvent body = new DisconnectEvent();
        body.player = player;
        body.session = session;
        body.cause = cause;
        return Event.valueOf(NAME, body);
    }

}
